/*
 * UdpRtpSocket.h
 *
 *  Created on: 2018年5月1日
 *      Author: chuanjiang.zh@qq.com
 */

#ifndef UDPRTPSOCKET_H_
#define UDPRTPSOCKET_H_

#include "BasicRtpSocket.h"
#include "TByteBuffer.h"
#include "SocketPair.h"

namespace av
{

class UdpRtpSocket: public BasicRtpSocket
{
public:
	UdpRtpSocket();
	virtual ~UdpRtpSocket();

	virtual bool open(const char* ip, int port);
	virtual void close();
	virtual bool isOpen();

	virtual NetAddress getLocalAddr();

	virtual bool send(RtpPacket& packet, int ms);

	virtual bool recv(RtpPacketHandler handler, int ms);

	virtual bool isConnected();

	virtual void abort();

protected:

protected:
	comn::Socket	m_socket;
	comn::SockAddr	m_addr;

	comn::ByteBuffer    m_sendBuffer;
	comn::ByteBuffer	m_recvBuffer;

	util::SocketPair  m_socketPair;

};


} /* namespace av */

#endif /* UDPRTPSOCKET_H_ */
